package br.ufal.tci.nexos.arcolive.beans;

import java.io.Serializable;

import javax.media.rtp.GlobalReceptionStats;
import javax.media.rtp.GlobalTransmissionStats;
import javax.media.rtp.RTPManager;

/**
 * @author <a href="mailto:felipe@labpesquisas.tci.ufal.br">Felipe Barros Pontes</a>.
 * @author <a href="mailto:leandro@labpesquisas.tci.ufal.br">Leandro Melo de
 *         Sales</a>.
 */
public class ConnectionManager implements Serializable {

	private GlobalReceptionStats receptionStats;

	private GlobalTransmissionStats transmissionStats;

	/**
	 * 
	 */
	public ConnectionManager() {
	}

	/**
	 * @param rtpManager
	 */
	public ConnectionManager(RTPManager rtpManager) {
		this.receptionStats = rtpManager.getGlobalReceptionStats();
		this.transmissionStats = rtpManager.getGlobalTransmissionStats();
	}

	/**
	 * @param receptionStats
	 * @param transmissionStats
	 */
	public ConnectionManager(GlobalReceptionStats receptionStats,
			GlobalTransmissionStats transmissionStats) {
		this.receptionStats = receptionStats;
		this.transmissionStats = transmissionStats;
	}

	/**
	 * @return
	 */
	public int getRTPPackagesSentCount() {
		return this.transmissionStats.getRTPSent();
	}

	/**
	 * @return
	 */
	public int getRTCPPackagesSentCount() {
		return this.transmissionStats.getRTCPSent();
	}

	/**
	 * @return
	 */
	public int getBytesSentCount() {
		return this.transmissionStats.getBytesSent();
	}

	/**
	 * @return
	 */
	public int getLocalCollisionsPackagesCount() {
		return this.transmissionStats.getLocalColls();
	}

	/**
	 * @return
	 */
	public int getRemoteCollisionsPackagesCount() {
		return this.transmissionStats.getRemoteColls();
	}

	/**
	 * @return
	 */
	public int getTransmitFailedPackagesCount() {
		return this.transmissionStats.getTransmitFailed();
	}

	/**
	 * @return
	 */
	public int getRTPPackagesReceivedCount() {
		// return this.receptionStats.getRTPRecd();
		return 0;
	}

	/**
	 * @return
	 */
	public int getRTCPPackagesReceivedCount() {
		return this.receptionStats.getRTCPRecd();
	}

	/**
	 * @return
	 */
	public int getBytesReceivedCount() {
		return this.receptionStats.getBytesRecd();
	}

}